/**
* @file				PushButton.c
* @author  		Milinda Seneviratne
* @version 		1.0
* @date    		November 17th, 2014
* @brief   		Template for thep push button ON switch.
*/

/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
#include "arduino.h"
/* Private typedef -----------------------------------------------------------*/
typedef int bool;
#define true 1
#define false 0
/* Private define ------------------------------------------------------------*/
#define PUSH_BUTTON_THRESHOLD (2^12-2^6) //This threshold corresponds to at least 1.5V wrt the 12but A2D
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
static bool pushButton;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

int getPushButtonStatus()
{
	int pushButtonInput = digitalRead(11); //PA6
	
	if (pushButtonInput>= (PUSH_BUTTON_THRESHOLD))
		pushButton=1;
	else
		pushButton=0;
	
	if (pushButton==1)
		return 1;
	else
		return 0;
}
